local riluohaiyanhuadan = fk.CreateSkill{
    name = "ym2__riluohaiyanhuadan",
}
Fk:loadTranslationTable{
    ["ym2__riluohaiyanhuadan"] = "日落海烟花弹",
    [":ym2__riluohaiyanhuadan"] = "每轮回合内外各限一次，当你获得牌后，若你的手牌数最多，你可以弃置当前回合角色一张牌，令本轮失去过【杀】的角色：本回合无法再使用或打出牌。",
    ["#ym2__riluohaiyanhuadan-invoke"] = "是否发动 日落海烟花弹，弃置 %dest 一张牌，令本轮失去过【杀】的角色本回合不能使用或打出牌",
    ["@@ym2__riluohaiyanhuadan-turn"] = "禁使用和打出牌",

    ["$ym2__riluohaiyanhuadan1"] = "各位，来看烟花吗？",
    ["$ym2__riluohaiyanhuadan2"] = "专属于你的烟花秀！",
}
riluohaiyanhuadan:addEffect(fk.AfterCardsMove,{
    can_trigger = function (self, event, target, player, data)
        if player:hasSkill(riluohaiyanhuadan.name) and ((player.room.current == player and player:getMark("ym2__riluohaiyanhuadan_current-round") == 0) or
        ((player.room.current ~= player and player:getMark("ym2__riluohaiyanhuadan_Nocurrent-round") == 0))) then
            if not player.room.current:isNude() and table.every(player.room.alive_players, function (p)
                return p:getHandcardNum() <= player:getHandcardNum()
            end) then
                for _, move in ipairs(data) do
                    if move.to == player and move.toArea == Card.PlayerHand then
                        return true
                    end
                end
            end
        end
    end,
    on_cost = function (self, event, target, player, data)
        if player.room:askToSkillInvoke(player,{
            skill_name = riluohaiyanhuadan.name,
            prompt = "#ym2__riluohaiyanhuadan-invoke::"..player.room.current.id
        }) then
            return true
        end
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        if room.current == player then
            room:setPlayerMark(player,"ym2__riluohaiyanhuadan_current-round",1)
        else
            room:setPlayerMark(player,"ym2__riluohaiyanhuadan_Nocurrent-round",1)
        end
        local card = room:askToChooseCard(player,{
            target = room.current,
            flag = "he",
            skill_name = riluohaiyanhuadan.name
        })
        room:throwCard(card,riluohaiyanhuadan.name,room.current,player)
        --room:setPlayerMark(player,"ym2__riluohaiyanhuadan-turn",1)
        for _, cp in ipairs(room.alive_players) do
            if #player.room.logic:getEventsOfScope(GameEvent.MoveCards, 1, function (e)
                for _, move in ipairs(e.data) do
                    if move.from and move.from == cp then
                        for _, info in ipairs(move.moveInfo) do
                            if info.fromArea <= Card.PlayerEquip and Fk:getCardById(info.cardId).trueName == "slash" then
                                return true
                            end
                        end
                    end
                end
            end, Player.HistoryRound) > 0 then
                room:setPlayerMark(cp,"@@ym2__riluohaiyanhuadan-turn",1)
            end
        end
    end,
})
--[[riluohaiyanhuadan:addEffect(fk.AfterCardsMove,{
    can_refresh = function (self, event, target, player, data)
        if player:getMark("ym2__riluohaiyanhuadan-turn") ~= 0 then
            for _, move in ipairs(data) do
                if move.from then
                    for _, info in ipairs(move.moveInfo) do
                        if info.fromArea <= Card.PlayerEquip and Fk:getCardById(info.cardId).trueName == "slash" then
                            player.room:setPlayerMark(move.from,"@@ym2__riluohaiyanhuadan-turn",1)
                        end
                    end
                end
            end
        end
    end,
})]]--
riluohaiyanhuadan:addEffect("prohibit", {
    prohibit_use = function (self, player, card)
        return player:getMark("@@ym2__riluohaiyanhuadan-turn") > 0 and card
    end,
    prohibit_response = function (self, player, card)
        return player:getMark("@@ym2__riluohaiyanhuadan-turn") > 0 and card
    end,
})
return riluohaiyanhuadan